package com.lyf.scm.job.remote.facade;

import com.lyf.scm.common.enums.ResponseMsg;
import com.lyf.scm.job.remote.BigDataStoreRemoteService;
import com.rome.arch.core.clientobject.Response;
import com.rome.arch.core.exception.RomeException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 大数据直营门店
 *
 * @author wangchlei
 * @date 2020/10/12
 */
@Slf4j
@Component
public class BigDataStoreFacade {
    @Resource
    private BigDataStoreRemoteService bigDataStoreRemoteService;

    public void handleApiDispatcher() {
        Response response = bigDataStoreRemoteService.handleApiDispatcher();
        if (!ResponseMsg.SUCCESS.getCode().equals(response.getCode())) {
            log.error("================== 执行大数据Job 失败 ==================");
            throw new RomeException(response.getCode(), response.getMsg());
        }
        log.info("================== 执行大数据Job 成功 ==================");
    }
}
